package com.yan.design.two.structure.s4;

import lombok.ToString;

/**
 * 4. 组合模式
 *     抽象组件
 * @author shengren.yan
 * @create 2022-07-27
 */
@ToString
public abstract class Component {

    private String name;
    private String des;

    public Component(String name, String des) {
        super();
        this.name = name;
        this.des = des;
    }

    public abstract void print();

    // 添加
    public abstract void add(Component c);


    // 减
    public abstract void remove(Component c);

    // 获取子组件
    abstract Component getChild(int index);

    //
    public abstract void test();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }
}
